<?php

require_once "./lib/WxPay.Api.php";
require_once './example/log.php';
require_once "./example/WxPay.Config.php";

//初始化日志
$logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
$log = Log::Init($logHandler, 15);

//$out_trade_no = "kcbjkq20200630102110";
$out_trade_no = $_GET['ono'];

$input = new WxPayOrderQuery();
$input->SetOut_trade_no($out_trade_no);
$config = new WxPayConfig();
$arr = WxPayApi::orderQuery($config, $input);
//echo "<pre>";
//print_r($arr);
//echo "</pre>";

if($arr['trade_state'] == 'SUCCESS'){
	echo json_encode($arr['trade_state']);
}else{
	echo json_encode("NO SUCCESS");
}

/*Array
(
    [appid] => wx958c2cc16f7108b3
    [attach] => 保温杯
    [bank_type] => OTHERS
    [cash_fee] => 1
    [cash_fee_type] => CNY
    [fee_type] => CNY
    [is_subscribe] => Y
    [mch_id] => 1535913711
    [nonce_str] => IHxQnIROldKWvKEJ
    [openid] => oMKYF1brS-9e5ihu6SZsF09zM-Dk
    [out_trade_no] => kcbjkq20200630102110
    [result_code] => SUCCESS
    [return_code] => SUCCESS
    [return_msg] => OK
    [sign] => 98E2A6B705B5FDAE3320328C7BBE16ECFEDAE84A7A434CF8DD81A5C45A13D1C2
    [time_end] => 20200630102139
    [total_fee] => 1
    [trade_state] => SUCCESS
    [trade_state_desc] => 支付成功
    [trade_type] => JSAPI
    [transaction_id] => 4200000592202006306345145591
)*/

?>

